<?php
/**
 * Created by PhpStorm.
 * User: shaowei
 * Date: 2018/12/21
 * Time: 上午11:44
 */

namespace App\Http\Services;

use App\Http\Model\GoodsLevel;
use App\Http\Model\Hint;


class GoodsLevelServices extends CommonServices
{
    private $GoodsLevelModel;

    public function __construct()
    {
        $this->GoodsLevelModel = new GoodsLevel();
    }

    /**
     * 用户商品等级
     * S、SR、SSR
     * @param array $where
     * @return array
     */
    public function getGoosLevelList($where=[])
    {
        $code = Hint::SUCCESS;
        $msg = Hint::getErrCodeMsg($code);
        $data = [];

        $list = $this->GoodsLevelModel ->list($where);
        if ($list){
            $data = array_map(function ($val){

                $val['icon'] = build_image($val['icon']);
                $val['bg_img'] = build_image($val['bg_img']);
                return $val;
            },$list);
        }

        return compact('code', 'msg', 'data');

    }





}